//
//  NSObject+SPValidity.m
//  SPKit
//
//  Created by LSP on 16/9/10.
//  Copyright © 2016年 SP. All rights reserved.
//

#import "NSObject+SPValidity.h"

@implementation NSObject (SPValidity)

- (BOOL)isValidString {
    return NO;
}
- (BOOL)isValidNumber {
    return NO;
}
- (BOOL)isValidArray {
    return NO;
}
- (BOOL)isValidDictionary {
    return NO;
}
- (BOOL)isValidData {
    return NO;
}

@end


@interface NSString (SPValidity)

@end
@implementation NSString (SPValidity)
- (BOOL)isValidString {
    return self.length && 
           [self stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]].length && 
           ![self isEqualToString:@"(null)"];
}
@end


@interface NSNumber (SPValidity)

@end
@implementation NSNumber (SPValidity)
- (BOOL)isValidNumber {
    return YES;
}
@end


@interface NSArray (SPValidity)

@end
@implementation NSArray (SPValidity)
- (BOOL)isValidArray {
    return self.count != 0;
}
@end


@interface NSDictionary (SPValidity)

@end
@implementation NSDictionary (SPValidity)
- (BOOL)isValidDictionary {
    return self.count != 0;
}
@end


@interface NSData (SPValidity)
@end
@implementation NSData (SPValidity)
- (BOOL)isValidData {
    return self.length != 0;
}
@end